#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


class Father:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def __str__(self):
        return f'{self.name}的年龄是：{self.age}'


class Son(Father):
    def __init__(self, name, age, address):
        # 调用父类的构造方法
        super().__init__(name, age)
        self.address = address

    def __str__(self):
        return f'{self.name}的年龄是：{self.age}，住在：{self.address}'


class GrandSon(Son):
    def __init__(self, *args, **kwargs):
        # 调用父类的构造方法
        # 在当前这个父类中存在多个实例属性，可以使用不定长参数进行接收
        super().__init__(*args, **kwargs)
        print('这里可以创建一些其他的实例属性...')


father = Father('父亲', 50)
print(father)

son = Son('儿子', 18, '北京')
print(son)

grandson = GrandSon('孙子', 10, address='深圳')
print(grandson)
